package com.feri.gpstudy.controller;

import com.feri.gpstudy.bo.MedicationAllBo;
import com.feri.gpstudy.entity.Medication;
import com.feri.gpstudy.service.intf.MedicationService;
import com.feri.gpstudy.service.intf.UserService;
import com.feri.gpstudy.vo.R;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/api/medication/")
public class MedicationController {
    @Resource
    private MedicationService service;

    /**
     * 新增药品
     * @param dao
     * @return
     */
    @PostMapping("save.do")
    public R save(@RequestBody Medication dao){return service.save(dao);}

    /**
     * 查询所有药品
     * @param bo
     * @return
     */
    @GetMapping("all.do")
    public R all(MedicationAllBo bo){return service.queryAll(bo);}
    @PostMapping("update.do")
    public R update(@RequestBody Medication medication){
        return service.update(medication);
    }
    @PostMapping("del.do")
    public R del(@RequestBody Map<String,Integer> map){
        return service.del(map.get("mid"));
    }
}
